hysop.operator.external_force module

class hysop.operator.external_force.SpectralExternalForce(vorticity, Fext, dt, variables, Fmin=None, Fmax=None, Finf=None, all_quiet=False, pbasename=None, ppbasename=None, implementation=None, base_kwds=None, **kwds)[source]

Bases: ComputationalGraphNodeFrontend

Generate an operator to compute the curl of a symbolic expression.

Create an operator that computes the curl of a given input force field Fext.

Only the following configurations are supported:

dim nb_components | dim nb_components

vorticity: 2 1 | 3 3

What is computed:

tmp = curl(Fext) by using a spectral backend Fmin = min(tmp) Fmax = max(tmp) Finf = max(abs(Fmin), abs(Fmax)) W += dt*tmp

where Fext is computed from user given ExternalForce.

Parameters:
  • vorticity (hysop.field.continuous_field.Field) – Continuous field as input ScalarField or VectorField. All contained field have to live on the same domain.

  • Fext (hysop.operator.external_force.ExternalForce) – Expression of the external force.

  • dt (ScalarParameter) – Timestep paramater.

  • F... (ScalarParameter, TensorParameter or boolean, optional) – TensorParameters should match the shape of tmp (see Notes). If set to True, the TensorParameter will be generated automatically.

  • all_quiet (bool) – Force all autogenerated TensorParameter to be quiet. By default, only the autogenerated TensorParameters that are not required by the user are set to be quiet.

  • pbasename (str, optional) – Parameters basename for created parameters. Defaults to ‘curl_{}’.format(Fext.name).

  • ppbasename (str, optional) – Parameters pretty basename for created parameters. Defaults to ‘|{} x {}|’.format(nabla, Fext.pretty_name).

  • variables (dict) – dictionary of fields as keys and topologies as values.

  • implementation (Implementation, optional, defaults to None) – target implementation, should be contained in available_implementations(). If None, implementation will be set to default_implementation().

  • kwds (dict, optional) – Extra parameters passed towards base class (MultiSpaceDerivatives).

Notes

If dim == 2, it is expected that:

vorticity has only one component Fext has 2 components Expected parameters are ScalarParameters or TensorParameters of shape (1,)

Else if dim == 3:

vorticity has 3 components Fext has 3 components Expected parameters are TensorParameter of shape (3,)

classmethod default_implementation()[source]

Return the default Implementation, should be compatible with available_implementations.

classmethod implementations()[source]

Should return all implementations as a dictionnary. Keys are Implementation instances and values are either ComputationalGraphNode or ComputationalGraphNodeGenerator.